$(function(){

    function isAndroid() {
        var userAgent = navigator.userAgent || navigator.vendor || window.opera;

        if (/android/i.test(userAgent)) {
          return true;
        }
        return false;
    }
   

   XT.getUserInfo(function(info){
       XT.debug(info)
   })
    var app=new Vue({
        el:'#app',
        data:{},
        methods:{
            openWx: function() {
                var that = this;
                that.openWxDialog()
                XT.bridge.call('copyToClipboard',{content: encodeURIComponent('百媚直播服务号')},function (res) {
                  if(isAndroid()) {
                    setTimeout(function(){
                      that.openWxDialog()
                    }, 2000)
                  }else {
                    that.openWxDialog()
                  }
                });

            },
            'openWxDialog': function() {
                MINT.MessageBox({
                    title: '提示',
                    message: '点击微信右上角+号,"添加朋友"粘贴并搜索,即可关注',
                    showCancelButton: true,
                    confirmButtonText: '前往微信',
                    closeOnClickModal: true
                }).then(action => {
                      if(action == 'confirm') {
                      window.location.href = 'bmlive://bmlive/openWX';
                  }
                })
            },
        } 
    })  
})
